<?php

namespace App\Models;

use Dcat\Admin\Models\Administrator;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;

class AdminCharityFund extends Model
{
	use HasDateTimeFormatter;
    use SoftDeletes;

    protected $table = 'admin_charity_fund';

    protected $fillable = [
        'admin_id',
        'group_id',
        'user_id',
        'title',
        'description',
        'charity_fund_type',
        'use_type',
        'start_time',
        'end_time',
        'address',
        'longitude',
        'latitude',
        'target_amount',
        'personal_donation_amount',
        'corporate_donation_amount',
        'random_donation_amount',
        'cover_path',
        'content',
        'fund_code',
        'online_status',
        'audit_status',
        'audit_response',
        'administrative_committee',
        'donation_type',
        'donate_together',
        'registration_number'
    ];

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function admin()
    {
        return $this->belongsTo(Administrator::class,'admin_id','id');
    }

    public function group()
    {
        return $this->belongsTo(Administrator::class,'group_id','id');
    }
}
